package cn.wuqingna.legendgem.attribute.imp

import ac.github.oa.api.OriginAttributeAPI
import cn.wuqingna.legendgem.attribute.IAttribute
import org.bukkit.Bukkit
import org.bukkit.entity.LivingEntity
import java.util.*

object OriginAttribute: IAttribute {
    override fun add(uuid: UUID, source: String, list: List<String>) {
        val data = OriginAttributeAPI.loadList(list)
        OriginAttributeAPI.setExtra(uuid, source, data)
    }

    override fun remove(uuid: UUID, source: String) {
        OriginAttributeAPI.removeExtra(uuid, source)
    }

    override fun upData(uuid: UUID) {
        val entity = Bukkit.getEntity(uuid)
        if (entity != null)
        OriginAttributeAPI.callUpdate(entity as LivingEntity)
    }
}